<!DOCTYPE html><html><head><title>Ext.util.Cookies | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.util.Cookies',
        docClass: 'Ext.util.Cookies',
        docReq: 'Ext.util.Cookies',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'Cookies.html#Ext-util.Cookies';
    clsInfo = {"methods":["clear","get","set"],"cfgs":[],"properties":[],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Cookies.html#Ext-util.Cookies" target="_blank">Ext.util.Cookies</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>Utility class for setting/reading values from browser cookies.
Values can be written using the <a href="Ext.util.Cookies.html#set" rel="Ext.util.Cookies#set" class="docClass">set</a> method.
Values can be read using the <a href="Ext.util.Cookies.html#get" rel="Ext.util.Cookies#get" class="docClass">get</a> method.
A cookie can be invalidated on the client machine using the <a href="Ext.util.Cookies.html#clear" rel="Ext.util.Cookies#clear" class="docClass">clear</a> method.</p>
<div class="members"><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-clear" class="member f ni"><a href="Ext.util.Cookies.html#method-clear" rel="method-clear" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Cookies.html" class="definedIn docClass">Ext.util.Cookies</a><br/><a href="../source/Cookies.html#Ext-util.Cookies-method-clear" class="viewSource">view source</a></div><a name="clear"></a><a name="method-clear"></a><a href="Ext.util.Cookies.html#" rel="method-clear" class="cls expand">clear</a>(
<span class="pre">String name, [String path]</span>)
 : void</div><div class="description"><div class="short">Removes a cookie with the provided name from the browser
if found by setting its expiration date to sometime in the p...</div><div class="long"><p>Removes a cookie with the provided name from the browser
if found by setting its expiration date to sometime in the past.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">name</span> : String<div class="sub-desc"><p>The name of the cookie to remove</p>
</div></li><li><span class="pre">path</span> : String<div class="sub-desc"><p>(optional) The path for the cookie. This must be included if you included a path while setting the cookie.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-get" class="member ni"><a href="Ext.util.Cookies.html#method-get" rel="method-get" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Cookies.html" class="definedIn docClass">Ext.util.Cookies</a><br/><a href="../source/Cookies.html#Ext-util.Cookies-method-get" class="viewSource">view source</a></div><a name="get"></a><a name="method-get"></a><a href="Ext.util.Cookies.html#" rel="method-get" class="cls expand">get</a>(
<span class="pre">String name</span>)
 : Mixed</div><div class="description"><div class="short">Retrieves cookies that are accessible by the current page. If a cookie
does not exist, get() returns null.  The follo...</div><div class="long"><p>Retrieves cookies that are accessible by the current page. If a cookie
does not exist, <code>get()</code> returns <tt>null</tt>.  The following
example retrieves the cookie called "valid" and stores the String value
in the variable <tt>validStatus</tt>.</p>

<pre><code>var validStatus = Ext.util.Cookies.get("valid");
</code></pre>

<h3 class="pa">Parameters</h3><ul><li><span class="pre">name</span> : String<div class="sub-desc"><p>The name of the cookie to get</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;<p>Returns the cookie value for the specified name;
null if the cookie name does not exist.</p>
</li></ul></div></div></div><div id="method-set" class="member ni"><a href="Ext.util.Cookies.html#method-set" rel="method-set" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Cookies.html" class="definedIn docClass">Ext.util.Cookies</a><br/><a href="../source/Cookies.html#Ext-util.Cookies-method-set" class="viewSource">view source</a></div><a name="set"></a><a name="method-set"></a><a href="Ext.util.Cookies.html#" rel="method-set" class="cls expand">set</a>(
<span class="pre">String name, Mixed value, Object expires, String path, String domain, Boolean secure</span>)
 : void</div><div class="description"><div class="short">Create a cookie with the specified name and value. Additional settings
for the cookie may be optionally specified (fo...</div><div class="long"><p>Create a cookie with the specified name and value. Additional settings
for the cookie may be optionally specified (for example: expiration,
access restriction, SSL).</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">name</span> : String<div class="sub-desc"><p>The name of the cookie to set.</p>
</div></li><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>The value to set for the cookie.</p>
</div></li><li><span class="pre">expires</span> : Object<div class="sub-desc"><p>(Optional) Specify an expiration date the
cookie is to persist until.  Note that the specified Date object will
be converted to Greenwich Mean Time (GMT).</p>
</div></li><li><span class="pre">path</span> : String<div class="sub-desc"><p>(Optional) Setting a path on the cookie restricts
access to pages that match that path. Defaults to all pages (<tt>'/'</tt>).</p>
</div></li><li><span class="pre">domain</span> : String<div class="sub-desc"><p>(Optional) Setting a domain restricts access to
pages on a given domain (typically used to allow cookie access across
subdomains). For example, "sencha.com" will create a cookie that can be
accessed from any subdomain of sencha.com, including www.sencha.com,
support.sencha.com, etc.</p>
</div></li><li><span class="pre">secure</span> : Boolean<div class="sub-desc"><p>(Optional) Specify true to indicate that the cookie
should only be accessible via SSL on a page using the HTTPS protocol.
Defaults to <tt>false</tt>. Note that this will only work if the page
calling this code uses the HTTPS protocol, otherwise the cookie will be
created with default options.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>